package main.collection;

import org.junit.Test;

import java.util.*;

import static main.string.jsonTest.gson;

/**
 * @author chenggm
 * @create 2017-02-09 21:17
 **/
public class GetList {
	private Set<Long> getIdList() {
		List<Long> idListByBaseMsg = new ArrayList<Long>();
		idListByBaseMsg.add(2L);
		idListByBaseMsg.add(3L);
		List<Long> idListbyAddress = new ArrayList<Long>();
		idListbyAddress.add(3L);
		idListbyAddress.add(4L);
		Set idList = new HashSet();
		if(!idListbyAddress.isEmpty()&&!idListByBaseMsg.isEmpty()){
			idList.addAll(idListByBaseMsg);
			idList.addAll(idListbyAddress);
			return idList;
		}
		if(idListbyAddress.isEmpty()&&!idListByBaseMsg.isEmpty()){
			return new HashSet<Long>(idListByBaseMsg);
		}
		if(!idListbyAddress.isEmpty()&&idListByBaseMsg.isEmpty()){
			return new HashSet<Long>(idListbyAddress);
		}
		return null;
	}
	@Test
	public void test() throws Exception{
		Set<Long> idList = getIdList();
		System.out.println(gson.toJson(idList));

	}

}
